﻿using MediatR;
using SystemHYS.API.Application.command.ProductionOrdersCommand;
using SystemHYS.Infrstructre.Interface;

namespace SystemHYS.API.Application.commandler.ProductionOrdersCommandler
{
    public class ProductionOrdersDeleteCommandler:IRequestHandler<ProductionOrdersDeleteCommand,int>
    {
        IProductionOrdersRepository OrdersRepository;

        public ProductionOrdersDeleteCommandler(IProductionOrdersRepository ordersRepository)
        {
            OrdersRepository = ordersRepository;
        }

        public async Task<int> Handle(ProductionOrdersDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await OrdersRepository.GetModelAsnc(request.ProductionOrdersId);
            list.IsDel = true;
            return await OrdersRepository.UpdateAsyn(list);
        }
    }
}
